show2000

	; setup graphics mode
	lda $d011
	ora #32
	sta $d011

	lda #$18
	sta $d018

	lda $d016
	ora #16
	sta $d016

	lda #3
	sta $dd00

;	lda $4710
;	sta $d021


	lda #0
	ldx #$00
	
___huja	sta $d800,x
	sta $d900,x
	sta $da00,x
	sta $db00,x
	
	sta $0400,x
	sta $0500,x
	sta $0600,x
	sta $0700,x
	dex
	bne ___huja
	
	
__lo
	jsr countline

	ldy #19
___lo	lda ($a0),y
	sta ($a2),y

	lda ($a4),y
	sta ($a6),y

	dey
	bne ___lo

	ldx #2
	jsr timer
	
	inc liniar
	lda liniar
	cmp #25
	bne __lo

	lda #25
	sta liniar

b__lo
	dec liniar
	jsr countline

	ldy #39
b___lo	lda ($a0),y
	sta ($a2),y

	lda ($a4),y
	sta ($a6),y

	dey
	bne b___lo

	ldx #2
	jsr timer
	
	lda liniar
;	cmp #25
	bne b__lo
	
;	ldy liniar
;	sta 0400tabl,y
	
;	lda 4328tabl,y
;	sta d800tabl,y

;	jmp *
	rts

; prepares addresses for copying colors from 16bit row address in RAM
; to VIC's VRAM spaces (for artstudio m-color)
countline
;a0 - source 3f40 * 40 addy
;a2 - targer 0400

;a4 - source 4328
;a6 - target d800

	lda liniar
	asl ;a
	tay
	sty liniar_x2
	
	lda a3f40tabl ,y ; tablica w kolejnosci hi/lo
	sta $a1		; a zapisz w kolejnosci lo / hi =)
	iny
	lda a3f40tabl ,y
	sta $a0
	
	ldy liniar_x2

	lda a0400tabl ,y 
	sta $a3		
	iny
	lda a0400tabl ,y
	sta $a2

	ldy liniar_x2
	;
	lda a4328tabl ,y 
	sta $a5		
	iny
	lda a4328tabl ,y
	sta $a4

	ldy liniar_x2
	
	lda ad800tabl ,y ; tablica w kolejnosci hi/lo
	sta $a7		; a zapisz w kolejnosci lo / hi =)
	iny
	lda ad800tabl ,y
	sta $a6

	rts

liniar	.byte 0 	; keeps lineaddy for countline
liniar_x2 .byte 0	; keeps ASLed liniar

dapr2000

	lda #0
	sta liniar
c__lo
	jsr countline

	ldy #40
c___lo	lda #0
	sta ($a2),y	; 0400
	sta ($a6),y	; d800

	dey
	dey
	;bpl c___lo
	bne c___lo	

	lda liniar
	sta liniar2	; save liniar coz
			; countline uses liniar
	lda #24
	sec
	sbc liniar
	sta liniar

	jsr countline

	ldy #40
d___lo	lda #0
	dey
	sta ($a2),y	; 0400
	sta ($a6),y	; d800
		
	dey
	;bpl c___lo
	bne d___lo	
	
	lda liniar2
	sta liniar	; restore liniar after lower part

	ldx #2
	jsr timer
	
	inc liniar
	lda liniar
	cmp #25
	bne c__lo

	rts

liniar2 .byte 0
